<template>
	<!-- 兑换订单详情 -->
	<view class="details_wp">
		<view class="d_bg"></view>
		<view class="d_body">
			<view class="d_buyers">
				<view>卖家信息</view>
				<view class="d_b_info">
					<text class="yticon icon-icon-test"></text>
					<view class="d_b_address">
						<view class="d_b_sname">{{info.order.supname}}<text @click="makePhoneCall"
								class="iconfont icon-kefu">联系卖家</text></view>
						<view class="d_b_address_o">{{info.order.address}}</view>
						<view class="d_b_name">联系电话：{{info.order.mobile}}</view>
					</view>
				</view>
			</view>

			<view class="d_shop">
				<view class="d_s_body" v-for="item in info.orderGoods" :key="item.id">
					<image :src="item.thumb" ></image>
					<view class="d_s_i_info">
						<view class="d_s_i_name">{{item.goodstitle}}</view>
						<view class="d_s_i_price"><text>{{item.realprice}}元 <text v-if="item.optionname"
									style="margin-left: 30upx;">规格:{{item.optionname}}</text></text>
							<view><text>×{{item.total}}</text></view>
						</view>
					</view>
				</view>
				<view class="d_s_list" v-if="item.goodstitle">
					<view>商品价格：</view>
					<view>{{nfo.orderGoods[0].realprice}}</view>
				</view>
				<view class="d_s_list">
					<view>支付现金：</view>
					<view>{{info.order.money}}</view>
				</view>
				<view class="d_s_list">
					<view>米券抵扣现金：</view>
					<view>-{{info.order.credit1}}</view>
				</view>
				<view class="d_s_list">
					<view>米券服务费：</view>
					<view>{{info.order.servicefee}}</view>
				</view>
				<view class="d_s_list">
					<view>赠送米券数量：</view>
					<view>{{info.order.sendcredit}}</view>
				</view>

				<view class="d_s_list" v-if="info.order.remark">
					<view>订单备注：</view>
					<view>{{info.order.remark}}</view>
				</view>
				<view class="d_s_statistics">
					<text>小计：</text>
					<text>{{info.order.totalmoney}}</text>
				</view>
				<view class="d_s_statistics">
					<text>实付现金：</text>
					<text>{{info.order.realmoney}}</text>
				</view>
			</view>
			<view class="d_order">
				<view class="d_o_title">订单信息</view>
				<view class="d_o_list">
					<text>订单编号</text>
					<text :selectable="true">{{info.order.ordersn}}</text>
				</view>
				<view class="d_o_list">
					<text>下单时间</text>
					<text>{{info.order.createtime}}</text>
				</view>
				<image class="m-image" :src="info.img" mode="widthFix"></image>
				<view style="text-align: center;" v-if="info.order.status==1">
					向商家出示核销码兑换商品
				</view>
			</view>
		</view>
		<view class="m_button" v-if="info.order.canrefund" @click="$navTo('/pages/order/Customer?id='+id)">
			{{info.order.refund_button}}</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id: '',
				info: {
					order: {
						address: {}
					},
					orderGoods: [],
					img: '',
				}
			}
		},
		onLoad(option) {
			this.id = option.id;
			this.getInfo();
		},
		methods: {
			getInfo() {
				this.$axios('Detail/getOrderInfo', 'POST', 'order', {
					id: this.id
				}).then(res => {
					if (res.data.code == 200) {
						this.info = res.data.data;
					}
				})
			},
			makePhoneCall() {
				var that = this;
				uni.makePhoneCall({
					phoneNumber: that.info.order.mobile

				});
			}
		}
	}
</script>

<style lang="scss">
	@import '/store/icon.css';

	page {
		background: #F2F2F2;
		color: $font-color-dark;
		padding-bottom: 150upx;
	}

	.details_wp {
		overflow: hidden;
	}

	.d_bg {
		background-color: $base-color;
		height: 200upx;
		position: absolute;
		margin-top: -4upx;
		width: 100%;
	}

	.d_body {
		padding: 20upx;
		position: relative;
		z-index: 50;
	}

	.d_buyers,
	.d_shop,
		{
		background-color: #fff;
		border-radius: 10upx;
		padding: 20upx;
		font-size: $font-base;
	}

	.d_b_info,
	.d_s_head,
	.d_s_body,
	.d_s_i_price,
	.d_s_list,
	.d_o_list {
		display: flex;
		align-items: center;
		padding: 20upx 0;
	}

	.d_b_info .yticon {
		background: rgba(0, 98, 204, 0.7);
		border-radius: 50%;
		color: #fff;
		padding: 15upx;
	}

	.d_b_address {
		padding-left: 20upx;
	}

	.d_b_sname {
		font-weight: bold;
		display: flex;
		align-items: center;
		justify-content: space-between;
	}

	.d_b_sname .iconfont {
		font-size: $font-base;
		font-weight: normal;
	}

	.d_b_address_o {
		color: $font-color-base;
		padding-top: 10upx;
		font-size: 26upx;
	}

	.d_b_name {
		color: $font-color-base;
		font-weight: normal;
		font-size: $font-sm;
	}

	.d_shop {
		font-size: 26upx;
		margin-top: 20upx;
	}

	.d_s_head {
		justify-content: space-between;
		font-size: $font-base;
	}

	.d_s_body {
		border-bottom: 1px hsl(0, 0%, 87%) solid;
	}

	.d_s_body image {
		border-radius: 10upx;
		height: 110upx;
		width: 110upx;
	}

	.d_s_i_info {
		flex: 1;
		padding-left: 10upx;
		line-height: 35upx;
	}

	.d_s_i_name {
		max-height: 68upx;
		overflow: hidden;
	}

	.d_s_i_price {
		justify-content: space-between;
		padding: 20upx 0 0;
	}

	.d_s_list {
		justify-content: space-between;
		padding: 20upx 0 0;
	}

	.d_s_list view:nth-of-type(1) {
		color: $font-color-base;
		padding-right: 30upx;
	}

	.d_s_list view:nth-of-type(2) {
		flex: 1;
		text-align: right;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.d_s_statistics {
		padding-top: 20upx;
		text-align: right;
	}

	.d_s_statistics text:nth-of-type(2) {
		color: $base-color;
	}

	.d_s_statistics text:nth-of-type(3) {
		color: $base-color;
		font-size: 20upx;
	}

	.d_order {
		background-color: #fff;
		border-radius: 10upx;
		margin-top: 20upx;
		padding: 20upx;
		line-height: 40upx;
	}

	.d_o_title {
		font-size: $font-base;
		padding-bottom: 10upx;
	}

	.d_o_list {
		padding: 0;
		justify-content: space-between;
	}

	.d_o_list text:nth-of-type(2) {
		color: $font-color-base;
	}

	.m-image {
		display: block;
		margin: 0 auto;
		height: 320upx;
		width: 320upx;
	}

	.m_button {
		background: $base-color;
		border-radius: 10upx;
		color: #fff;
		margin: 0 3%;
		position: fixed;
		bottom: 30upx;
		text-align: center;
		letter-spacing: 1px;
		line-height: 70upx;
		width: 94%;
		z-index: 500;
	}
</style>
